package com.sunni.dao_old.impl;

import com.sunni.dao_old.EmployeeDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;

@Component("employeeDao")
public class EmployeeDaoImpl implements EmployeeDao {

    @Autowired
    @Qualifier("jdbcTemplate")
    private JdbcTemplate jdbcTemplate;

    @Override
    public void out(String outMan, Double money) {
        jdbcTemplate.update("update employee set money=money-? where name=?",money,outMan);
    }

    @Override
    public void in(String inMan, Double money) {
        jdbcTemplate.update("update employee set money=money+? where name=?",money,inMan);
    }
}
